const Base = require('./base');
module.exports = class extends Base{
  async getGtCaptchaAction() {
    const geetestService = this.service('public/geetestService');
    const res = await geetestService.register();
    return this.success(res);
  }
  
  async validateAction() {
    const challenge = this.post('geetest_challenge');
    const validate = this.post('geetest_validate');
    const seccode = this.post('geetest_seccode');
    const captcha = new Geetest({
      geetest_id: '0ac1207f5e0bf9dea47316f40c9fb4e2',
      geetest_key: '1edf6f63aed115999dc56031bfe0b7b4',
    });
    const res = await captcha.validate({
      challenge: challenge,
      validate: validate,
      seccode: seccode
    })
    return this.success(res);
  }
}